<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{ backdrop: 'static', keyboard: !saving }">
    <div class="modal-dialog model-md">
        <div class="modal-content">
            <form *ngIf="active" #userForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="codeRuleFormatViewDto.itemTypeName != undefined">编辑规则</span>
                        <span *ngIf="codeRuleFormatViewDto.itemTypeName == undefined">创建规则</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                        [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">

                    <div class="row">
                        <div class="col-md-2">
                            <label for="EnCode">前缀 *</label>
                        </div>
                        <div class="form-group col-md-10">
                            <p-dropdown name="ItemType" [options]="itemTypeAyy" [(ngModel)]="selectedItemType" (onChange)="changetype()" 
                                [style]="{ width: '380px' }"></p-dropdown>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-2">
                            <label for="FullName">格式 *</label>
                        </div>
                        <div class="form-group col-md-10">
                            <input *ngIf="selectedItemTypeID==1" id="FullName" #FullNameInput="ngModel" type="text"
                                name="FullName" class="form-control" [(ngModel)]="codeRuleFormatViewDto.formatStr"
                                required maxlength="32" />

                            <p-dropdown *ngIf="selectedItemTypeID==2" name="ItemDateAyy" [options]="itemDateAyy"
                                [(ngModel)]="selectedItemDate" [style]="{ width: '380px' }"></p-dropdown>

                            <p-dropdown *ngIf="selectedItemTypeID==3" name="ItemCodeAyy" [options]="itemCodeAyy"
                                [(ngModel)]="selectedItemCode" [style]="{ width: '380px' }"></p-dropdown>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-2">
                            <label for="Description">步长 </label>
                        </div>
                        <div class="form-group col-md-10">
                            <input id="Description" type="text" name="Description" class="form-control" [disabled]="isDisable"
                                [(ngModel)]="codeRuleFormatViewDto.stepValue" maxlength="256" />
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-2">
                            <label for="Description">初值 </label>
                        </div>
                        <div class="form-group col-md-10">
                            <input id="Description" type="text" name="Description" class="form-control"  [disabled]="isDisable"
                                [(ngModel)]="codeRuleFormatViewDto.initValue" maxlength="256" />
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-2">
                            <label for="Desription">备注 </label>
                        </div>
                        <div class="form-group col-md-10">
                            <input id="Desription" type="text" name="Desription" class="form-control"
                                [(ngModel)]="codeRuleFormatViewDto.desription" maxlength="256" />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">
                        取消
                    </button>
                    <button type="submit" class="btn btn-primary" [disabled]="!userForm.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')">
                        <span>保存</span>
                    </button>
                </div>
            </form>
        </div>
    </div>

</div>